//
//  YBThreeViewController.m
//  GoodBuy
//
//  Created by Cyber on 15/5/22.
//  Copyright (c) 2015年 GoodBuy. All rights reserved.
//

#import "YBThreeViewController.h"

@interface YBThreeViewController ()

@end

@implementation YBThreeViewController

-(void)dealloc {
    [_tableView release];
    [super dealloc];
}
- (void)viewWillAppear:(BOOL)animated {
    self.tabBarController.tabBar.hidden = YES;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.tableView = [[UITableView alloc]initWithFrame:[[UIScreen mainScreen]bounds] style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource =self;
    [self.view addSubview:_tableView];
    [_tableView release];
    
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellIdrntifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdrntifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdrntifier];
    }
    YBNewsDetailModel *newsDetai = [_allArray objectAtIndex:indexPath.row];
    cell.textLabel.text = newsDetai.article_title;
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    YBNewsDetailViewController *detailVC = [[YBNewsDetailViewController alloc]init];
    detailVC.newsListModel = [_allArray objectAtIndex:indexPath.row];
    [self.navigationController pushViewController:detailVC animated:YES];
    
    

    
}





-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [_allArray count];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
